/* 引入MockAjax */
import mockAjax from '@/api/index'

export default{
    state:{
        banner:[],
        menus:[]

    },
    mutations:{
        RECEIVE_BANNER(state,result){
            state.banner = result
        },
        receive_menus(state,result){
            state.menus = result
        }

    },
    actions:{
        async getBanner({commit}){
            const result = await mockAjax.mockBanner()
            if(result.length <= 0){
                console.log('Mock数据出错');
            }else{
             commit('RECEIVE_BANNER',result)
            }
        },
        async getMenus({commit}){
            const result = await mockAjax.mockMenus()
                if(result.length <=0){
                 console.log('Mock数据出错');

                }else{
                    commit('receive_menus',result)
                }
            
        }

    }
}